package com.xf.lastmall.order.api.constant;

public enum OrderType {
	
	/**
	 * 秒杀
	 */
	SECKILLORDER("1","秒杀"),
	/**
	 * 包含单品和套餐，sale_way_=1 为单品普买，sale_way_=2 为套餐， sale_way_ = 3 为购物车
	 */
	GROUPPURCHASEORDER("2","团购"),
	/**
	 * 创意活动
	 */
	ACTIVITY("3","创意活动"),
	/**
	 * 拼团
	 */
	GROUPBUY_JOIN("4","拼团"),
	/**
	 * 拼团单独购买
	 */
	GROUPBUY_BUY("5","拼团单独购买"),

	/**
	 * 积分兑礼
	 */
	GIFT_EXCHANGE("8","积分兑礼"),
	/**
	 * 商户买单
	 */
	MERCAHNT_ORDER_BUY("11","商户买单"),
	/**
	 * 跨场售卖订单
	 */
	OUT_MERCHANT("12","跨场售卖"),

	BOUTIQUE_APPLET("13","精品小程序"),

	EQUITY_PACKAGE("15","权益包"),

	TIKTOK_ORDER("17","抖音订单"),

	ECOMM_ORDER("19","商业电商订单");

	private String value;

	private String text;

	OrderType(String value, String text) {
		this.value = value;
		this.text = text;
	}

	public String getValue() {
		return this.value;
	}

	public String getText() {
		return this.text;
	}

	public static OrderType fromValue(String value) {
		for (OrderType action : OrderType.values()) {
			if(action.getValue().equals(value)){
				return action;
			}
		}
		return GROUPPURCHASEORDER;
	}
	
	public static OrderType fromText(String text) {
		for (OrderType action : OrderType.values()) {
			if(action.getText().equals(text)){
				return action;
			}
		}
		return GROUPPURCHASEORDER;
	}

}
